package edu.webtek.clouddata;

import org.jdom2.Element;

public class Customer {
	private final int customerID;
	private final String customerName;
	
	public int getCustomerID() {
		return customerID;
	}

	public String getCustomerName() {
		return customerName;
	}

	public Customer(Element cust) {
		int customerID = -1;
		String customerName = "NULL";
		
		for(Element attr : cust.getChildren()){
			String data = attr.getText();
			switch(attr.getName()){
			case "customerID":
				customerID = Integer.parseInt(data);
				break;
			case "customerName":
				customerName = data;
				break;
			}
		}
		
		this.customerID   = customerID;
		this.customerName = customerName;
	}

	@Override
	public String toString() {
		return "Customer [customerID=" + customerID + ", customerName="
				+ customerName + "]";
	}
	
	
}
